package com.example.rbacmanage.service.system.impl;

import com.example.rbacmanage.entity.system.ParamSetting;
import com.example.rbacmanage.mapper.system.ParamSettingMapper;
import com.example.rbacmanage.service.system.ParamSettingService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class ParamSettingServiceImpl implements ParamSettingService {
    @Autowired
    private ParamSettingMapper paramSettingMapper;
    @Override
    public void save(ParamSetting paramSetting) {
        paramSetting.setCreateTime(new Date());
        paramSettingMapper.insert(paramSetting);
    }

    @Override
    public void remove(Long[] ids) {
        for (Long id : ids) {
            paramSettingMapper.del(id);
        }
    }

    @Override
    public void update(ParamSetting paramSetting) {
        paramSettingMapper.update(paramSetting);
    }

    @Override
    public List<ParamSetting> getAll(ParamSetting paramSetting) {
        return paramSettingMapper.list(paramSetting);
    }

    @Override
    public PageInfo<ParamSetting> getPage(ParamSetting paramSetting) {
        return new PageInfo<>(getAll(paramSetting));
    }

    @Override
    public ParamSetting getById(Long id) {
        return paramSettingMapper.queryOneById(id);
    }

    @Override
    public Integer getCount(ParamSetting paramSetting) {
        return paramSettingMapper.count(paramSetting);
    }
}
